﻿@{
    ViewBag.Title = "职员岗位管理";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
}
<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <form action="" class="layui-form">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="empID" class="layui-input" placeholder="请输入工号" value="@ViewBag.EmpID">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <button type="button" class="layui-btn searchButton">搜索</button>
                </div>
            </div>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: true,limit:15}" lay-filter="resultList" id="resultList">
        <thead>
            <tr>
                <th lay-data="{field:'ID', width:80}">ID</th>
                <th lay-data="{field:'EmpID', width:80}">EmpID</th>
                <th lay-data="{ field: 'DepartmentName'}">部门</th>
                <th lay-data="{ field: 'Name'}">岗位</th>
                <th lay-data="{ field: 'StartTime', width:110}">开始时间</th>
                <th lay-data="{ field: 'EndTime', width:110}">结束时间</th>
                <th lay-data="{field:'StatusName', width:80}">状态</th>
                <th lay-data="{fixed: 'right', width:150, align:'center', toolbar: '#barDemo'}">操作</th>
            </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/EmployeePosition/Edit?id={{d.ID}}','编辑{{d.EmpID}}岗位',7)" lay-event="delete" lay-data="{{d}}">编辑</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:DeleteItem({{d.ID}})" lay-event="eidt" lay-data="{{d}}">删除</a>
    </script>

</div>
<script type="text/javascript">
    function DeleteItem(id) {
        layer.confirm('您确认需要删除该职员岗位信息吗？', {
            btn: ['我要删除', '不小心点错了'], title: '职员岗位信息删除确认' //按钮
        }, function () {
            var url = "/Management/EmployeePosition/Delete?id=" + id;
            $.getJSON(url, function (data) {
                if (data.State === 200) {
                    layer.msg("职员岗位删除成功");
                    $(".layui-laypage-btn")[0].click();
                }
                else {
                    layer.msg(data.Message);
                }
            });
        }, function () {

        });
    }     
</script>


